<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 面向对象编程
      const calculator = {
        // v1:'',
        // v2:'',
        read(x, y) {
          this.v1 = x;
          this.v2 = y;
        },
        mul() {
          return this.v1 * this.v2;
        },
        sum() {
          return this.v1 + this.v2;
        },
      };
      calculator.read(4, 2);
      console.log(calculator.sum());
      console.log(calculator.mul());
      console.log(calculator);
    </script>
  </body>
</html>
